var cheerio = require('cheerio');
var express = require('express');
var mysql = require('mysql');
var superagent = require('superagent');

var mysqlConfig = require('./config').mysqlConfig;



var app = express();

app.get('/fund', function (req1, res1) {
    res1.header('Access-Control-Allow-Origin', '*');

    var connection1 = mysql.createConnection(mysqlConfig);
    connection1.connect();
    var query1 = 'select * from follow_list order by fund_name';
    connection1.query(query1, function (err2, res2) {
        if (err2) {
            console.log('err');
            console.log(err2);

        } else {
            console.log('res');
            console.log(res2);
            res1.send(res2);
        }
    });
    connection1.end();
});

app.listen(3000, function () {
    console.log('Example app listening on port 3000!');
});